<form enctype="multipart/form-data" action="<?php echo $PHP_SELF; ?>&submitted=1" method="POST">
<input type="hidden" name="id" value="<?php echo $c->song->id; ?>"/>
<h3>Events</h3>
<div id="searchshow">
<a href="#" onclick="javascript:toggleVisibility('search');">Show Search</a>
</div>
<div id="search" style="display:none;">
<a href="#" onclick="javascript:toggleVisibility('search');">Hide Search</a>
    <table id="data">
    	<tr><th>Title:</th><td><input type="text" name="title" value="<?php echo $c->event->title; ?>" /></td></tr>
    	<tr><th>Type:</th><td><?php echo dropdown("event_type", $c->event->event_type); ?><br/></td></tr>
    	<tr><th>Status:</th><td><?php echo dropdown("event_status", $c->event->event_status); ?><br/></td></tr>
    	<tr><th>Contact:</th><td><?php echo tableDropdown("contact_id", $c->event->contact_id, $c->contacts, "lastname, firstname"); ?></td></tr>
    	<tr><th>Location:</th><td><?php echo tableDropdown("location_id", $c->event->location_id, $c->locations, "name"); ?></td></tr>
    	<!--<tr><th>Start/End:</th><td><input type="text" name="start" value="<?php echo $c->event->start; ?>" size="9" /> - <input type="text" name="end" value="<?php echo $c->event->end; ?>" size="9" /></td></tr>-->
    	<tr><th>Public:</th><td><input type="checkbox" name="is_public" value="T" <?php if ($c->event->public == "T") echo "checked"; ?>/></td></tr>
    	<tr><td>&nbsp;</td><td><input type="submit" name="action" value="Search" /></td></tr>
    </table>
<br/>
</div>
<br/>
<?php if (count($c->events) > 0) { ?>
<table id="results">
<tr><th>Title</th><th>Type</th><th>Status</th><th>Public?</th><th>Date</th><th>Start Time</th><th>End Time</th></tr>
<?php
 foreach ($c->events as $event)
 {
   ?><tr>
   		<td><?php echo HtmlUtil::internalLink("[edit]", "event", $userRoles, array("action" => "load", "id" => $event->id)); ?>
   		    <?php echo HtmlUtil::internalLink($event->title, "viewEvent", $userRoles, array("action" => "load", "id" => $event->id)); ?></td>
   		<td><?php echo CodeLookupUtil::getValue("event_type", $event->event_type); ?></td>
   		<td><?php echo CodeLookupUtil::getValue("event_status", $event->event_status); ?></td>
   		<td><?php echo ($event->is_public == "T") ? "Yes" : "No"; ?></td>
   		<td><?php echo HtmlUtil::formatDateOnly($event->start); ?></td>
   		<td><?php echo HtmlUtil::formatTimeOnly($event->start); ?></td>
   		<td><?php echo HtmlUtil::formatTimeOnly($event->end); ?></td>
   	 </tr>
   <?php
 }
?>
</table>
<?php } ?>
</form>